home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / CPlusIncludes / FileTransfers.h < prev    next >
Text File  |  1991-05-01  |  5KB  |  198 lines

  1. /*
  2.     File:        FileTransfers.h
  3.  
  4.     Contains:    C Interface to the File Transfer Manager
  5.  
  6.     Copyright:    © 1988-1990 by Apple Computer, Inc.
  7.                 All rights reserved.
  8.  
  9. */
  10.  
  11.  
  12. #ifndef __FILETRANSFERS__
  13. #define __FILETRANSFERS__
  14.  
  15. #ifndef __PACKAGES__
  16. #include <Packages.h>
  17. #endif    __PACKAGES__
  18.  
  19. #ifndef __GEOMETRY__
  20. #include <Geometry.h>
  21. #endif
  22.  
  23. #ifndef __CTBUTILITIES__
  24. #include <CTBUtilities.h>
  25. #endif    __CTBUTILITIES__
  26.  
  27. /* current file transfer manager version    */
  28. #define        curFTVersion        2
  29.  
  30. /* FTErr    */
  31. typedef    OSErr FTErr;
  32.  
  33. #define        ftGenericError        (-1)
  34. #define        ftNoErr                0
  35. #define     ftRejected            1
  36. #define     ftFailed            2
  37. #define     ftTimeOut            3
  38. #define        ftTooManyRetry        4
  39. #define        ftNotEnoughDSpace    5
  40. #define        ftRemoteCancel        6
  41. #define        ftWrongFormat        7
  42. #define        ftNoTools            8    
  43. #define        ftUserCancel        9
  44. #define     ftNotSupported         10
  45.  
  46. /* FTDirection     */
  47. typedef short FTDirection;
  48.  
  49. enum {
  50.     ftReceiving,
  51.     ftTransmitting,
  52.     ftFullDuplex
  53. };
  54.  
  55. /* FTFlags    */
  56. typedef unsigned long FTFlags;
  57.  
  58. enum {
  59.     ftIsFTMode     = 1 << 0,
  60.     ftNoMenus     = 1 << 1,
  61.     ftQuiet     = 1 << 2,
  62.     ftSucc         = 1 << 7
  63. };
  64.  
  65. /* FTAttributes    */
  66. typedef short FTAttributes;
  67. enum {
  68.     ftSameCircuit         = 1 << 0,
  69.     ftSendDisable         = 1 << 1,
  70.     ftReceiveDisable     = 1 << 2,
  71.     ftTextOnly             = 1 << 3,
  72.     ftNoStdFile         = 1 << 4
  73. };
  74.  
  75. /* FTChoose data structures */
  76. struct FTChooseRec {
  77.     long    reserved;
  78.     long    msg;
  79.     ProcPtr    idleProc;
  80.     ProcPtr    filterProc;
  81.     Str63    newTool;
  82.     Ptr        newConfig;
  83.     ProcPtr    eventProc;
  84. };
  85.  
  86. typedef FTChooseRec *FTChooseRecPtr;
  87.  
  88. /* FTChooseRec messages */
  89. #define    ftChooseNochange        1
  90. #define    ftChooseBackdoor        2
  91.  
  92.  
  93. struct FTRecord
  94. {    
  95.     short            procID;
  96.  
  97.     FTFlags            flags;
  98.     FTErr            errCode;
  99.  
  100.     long            refCon;
  101.     long            userData;
  102.  
  103.     ProcPtr            defProc;
  104.  
  105.       Ptr                config;
  106.       Ptr                oldConfig;
  107.  
  108.     ProcPtr            environsProc;
  109.     long            reserved1;
  110.     long            reserved2;
  111.         
  112.     Ptr                ftPrivate;
  113.  
  114.      ProcPtr            sendProc;
  115.       ProcPtr            recvProc;
  116.     ProcPtr            writeProc;
  117.     ProcPtr            readProc;
  118.  
  119.      WindowPtr        owner;
  120.     
  121.     FTDirection        direction;
  122.       SFReply            theReply;
  123.  
  124.       long              writePtr;
  125.       long              readPtr;
  126.       char              *theBuf;
  127.     long            bufSize;
  128.     Str255            autoRec;
  129.     FTAttributes    attributes;
  130. };
  131.  
  132. typedef FTRecord  *FTPtr, **FTHandle;
  133.      
  134.      
  135. #ifdef __cplusplus
  136. extern "C" {
  137. #endif        
  138. pascal FTErr     InitFT(void);
  139. pascal Handle     FTGetVersion(FTHandle hFT);
  140. pascal short     FTGetFTVersion(void);
  141.     
  142. pascal FTHandle FTNew(short procID, FTFlags flags, ProcPtr sendProc, 
  143.                         ProcPtr recvProc, ProcPtr readProc, ProcPtr writeProc, 
  144.                         ProcPtr environsProc, WindowPtr owner, long refCon, 
  145.                         long userData);
  146.  
  147. pascal void     FTDispose(FTHandle hFT);
  148.  
  149. pascal FTErr     FTStart(FTHandle hFT, FTDirection direction, const SFReply& fileInfo);
  150. pascal FTErr     FTAbort(FTHandle hFT);
  151.  
  152. pascal void     FTExec(FTHandle hFT);
  153.  
  154. pascal void     FTActivate(FTHandle hFT, Boolean activate);
  155. pascal void     FTResume(FTHandle hFT, Boolean resume);
  156. pascal Boolean     FTMenu(FTHandle hFT, short menuID, short item);
  157.  
  158. pascal short     FTChoose(FTHandle& hFT, Point where, ProcPtr idleProc);
  159. pascal short     FTPChoose(FTHandle& hFT, Point where, FTChooseRec& cRec);
  160. pascal void     FTEvent(FTHandle hFT, const EventRecord& theEvent);
  161.  
  162. pascal Boolean     FTValidate(FTHandle hFT); 
  163. pascal void     FTDefault(Ptr& theConfig, short procID, Boolean allocate);
  164.  
  165. pascal Handle     FTSetupPreflight(short procID, long& magicCookie);
  166. pascal void     FTSetupSetup(short procID, const void *theConfig, short count, DialogPtr theDialog,
  167.                     long& magicCookie);
  168. pascal Boolean     FTSetupFilter(short procID, const void *theConfig, short count, DialogPtr theDialog,
  169.                     EventRecord& theEvent, short& theItem, long& magicCookie);
  170. pascal void        FTSetupItem(short procID, const void *theConfig, short count, DialogPtr theDialog,
  171.                     short& theItem, long& magicCookie);
  172. pascal void     FTSetupCleanup(short procID, const void *theConfig, short count, DialogPtr theDialog,
  173.                     long& magicCookie);
  174. pascal void     FTSetupXCleanup(short procID, const void *theConfig, short count, DialogPtr theDialog,
  175.                     Boolean OKed, long& magicCookie);
  176. pascal void     FTSetupPostflight(short procID);
  177.  
  178. pascal Ptr         FTGetConfig(FTHandle hFT);
  179. pascal short     FTSetConfig(FTHandle hFT, const void *thePtr);
  180.  
  181. pascal OSErr     FTIntlToEnglish(FTHandle hFT, const void *inputPtr, Ptr& outputPtr, short language);
  182. pascal OSErr     FTEnglishToIntl(FTHandle hFT, const void *inputPtr, Ptr& outputPtr, short language);
  183.  
  184. pascal void     FTSetRefCon(FTHandle hFT, long refCon);
  185. pascal long     FTGetRefCon(FTHandle hFT);
  186.  
  187. pascal void     FTSetUserData(FTHandle hFT, long userData);
  188. pascal long     FTGetUserData(FTHandle hFT);
  189.  
  190. pascal void     FTGetToolName(short procID, Str255& name);
  191. pascal short      FTGetProcID(ConstStr255Param name);
  192.  
  193. pascal void        FTGetErrorString(FTHandle hFT, short id, Str255& errMsg);
  194. #ifdef __cplusplus
  195. }
  196. #endif    
  197.  
  198. #endif __FILETRANSFERS__